#ifndef _BORAD_H_
#define _BORAD_H_

#include "hardwire.h"
#include "mcu_top.h"
#include "typedef.h"

#define BSP_MCU_MODEL       POLSYS_MCU_CST92F25

#define Board_GetTickCycleValue()   SYSTICK_VALUE

#define Board_GetTickNowValue()     (SYSTICK_VALUE - SysTick->VAL)

void Board_Init();

#define Board_SetLcdRsLevel(l)      HalGpioSet(LCD_RS_PIN, (bit_action_e)l)

#define Board_SetLcdBrLevel(l)      HalGpioSet(LCD_BR_PIN, (bit_action_e)l)

#define Board_GetDcIn()             HalGpioGet(DCIN_PIN)

// 获取键盘AD值
u16 Board_GetKbValue();

#define Board_StartFlashSpiCs()     HalGpioSet(SPI_FLASH_CS_PIN, (bit_action_e)0)

#define Board_StopFlashSpiCs()      HalGpioSet(SPI_FLASH_CS_PIN, (bit_action_e)1)

#define Board_StartLchSpiCs()       HalGpioSet(SPI_LCD_CS_PIN, (bit_action_e)0)

#define Board_StopLchSpiCs()        HalGpioSet(SPI_LCD_CS_PIN, (bit_action_e)1)

/**
 * 向LCD发数据
 * @return true:操作成功
*/
#define Board_LcdSpiSend(t_buff, len) Spi_Send(t_buff, len)

/**
 * 向FLASH发送或者从FLASH接收数据
 * @return true:操作成功
*/
#define Board_FlashSpiReceive(r_buff, len)  Spi_Trans(r_buff, NULL, len)

#define Board_FlashSpiSend(t_buff, len)   Spi_Send(t_buff, len)


// 获取本机电池电压 mV
u16 Board_GetVBat();

#define Adc_GetCH()     0

void Board_Sleep();

#endif
